package me.helllp.book.concurrent.ch05;

/**
 * 好的单例模式
 * 
 * @author Administrator
 *
 */
public class StaticSingleton {
	//	定义为私有
	private StaticSingleton(){
		System.out.println("单例对象被创建");
	}
	
	private static class StaticSingletonHolder {
		private static StaticSingleton instance = new StaticSingleton();
	}
	
	//	可以无锁的控制对象的创建时间
	public static StaticSingleton getInstance(){
		return StaticSingletonHolder.instance;
	}
}
